import React, { lazy, Suspense } from "react";

const Api = lazy(() => import("@/views/api/index"));
const Hooks = lazy(() => import("@/views/hooks/index"));
const Methods = lazy(() => import("@/views/methods/index"));

const Lazy = (Comp: React.ReactNode) => {
  return <Suspense fallback={"加载中"}>{Comp}</Suspense>;
};

export const adminRoutes = [
  {
    path: "api",
    element: Lazy(<Api />),
  },
  {
    path: "hooks",
    element: Lazy(<Hooks />),
  },
  {
    path: "methods",
    element: Lazy(<Methods />),
  },
];
